package com.example.web.config;

import javax.jms.Connection;
import javax.jms.JMSException;

import org.apache.activemq.ActiveMQConnectionFactory;

import lombok.extern.slf4j.Slf4j;

/**
 * 	这样设计感觉太合理
 * @author yzl
 *
 */
@Slf4j
public class MQConfig {

	public static final String url ="tcp://127.0.0.1:61616";
	
	public static final String userName="admin";
	
	public static final String password="admin";
	
	public static final String queueName="queue_0.0.";
	
	public static final String topicName="topic_0.0.";
	
	/**
	 *	建立连接
	 */
	public static Connection connection ;
	static {
		try {
			connection =new ActiveMQConnectionFactory(MQConfig.userName,MQConfig.password,MQConfig.url).createConnection();
			connection.start();
		} catch (JMSException e) {
			log.info("创建连接失败：{}",e);
			e.printStackTrace();
		}
	}
}
